feat(ENG-821): setup and config field validation#183
Open
chandrajeet-singh wants to merge 3 commits into
Open
Conversation
- Anchor the local FORMAT_PATTERNS copy (url/uri; datetime requires seconds, optional fraction/offset) to match @stackone/core - Add local FormatName copy and tighten FalconFieldValidation to the XOR shape matching the authoring contract - Sync canonical accept/reject vectors in check-format-vectors (npm test) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds client-side validation support for connector setup/config fields in the integration picker, including Falcon-style validation (format/pattern) while preserving legacy (v2) connector validation behavior. It also adds a small CI-style guard to keep a local copy of format regexes aligned with the canonical @stackone/core accept/reject vectors.
Changes:
- Extend
ConnectorConfigField.validationto support both legacy and Falcon validation contracts (includingformat-based validation). - Add a local
FORMAT_PATTERNSregistry and rule-resolution helpers to apply validations in the Zod schema builder. - Add a
npm testscript that runs a vector-check script to prevent regex drift.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/modules/integration-picker/utils/zodSchema.ts | Introduces format/pattern validation resolution and applies the resolved regex rule to Zod field schemas. |
| src/modules/integration-picker/types.ts | Adds typed validation contracts for legacy vs Falcon connectors and updates ConnectorConfigField.validation. |
| scripts/check-format-vectors.ts | Adds a script to validate the local format regex registry against known accept/reject vectors. |
| package.json | Updates npm test to run the new vector-check script via tsx. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+42
| if (validation.type === 'html-pattern') { | ||
| return { | ||
| pattern: new RegExp(validation.pattern), | ||
| errorMessage: | ||
| validation.error || `Please match the required format: ${validation.pattern}`, | ||
| }; | ||
| } |
Comment on lines
+44
to
+50
| if (validation.type === 'domain') { | ||
| return { | ||
| pattern: new RegExp(`.*${validation.pattern}\\.com.*`), | ||
| errorMessage: | ||
| validation.error || `Please enter a valid ${validation.pattern}.com domain`, | ||
| }; | ||
| } |
Comment on lines
+66
to
+71
| if (validation.pattern) { | ||
| return { | ||
| pattern: new RegExp(validation.pattern), | ||
| errorMessage: validation.errorMessage || `${label} format is invalid`, | ||
| }; | ||
| } |
Comment on lines
+59
to
+65
| for (const [format, vectors] of Object.entries(FORMAT_PATTERN_TEST_VECTORS)) { | ||
| const pattern = FORMAT_PATTERNS[format as keyof typeof FORMAT_PATTERNS]; | ||
| if (!pattern) { | ||
| failures++; | ||
| console.error(`FAIL: registry is missing format "${format}"`); | ||
| continue; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.